﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Web.UI;

using Developmentalmadness.Web.UI.AjaxAbstractions;

namespace Developmentalmadness.Web.UI.ExtJsControlLibrary
{
    public abstract class ExtJsObservable : ExtJsControl
    {
        public String listeners { get; set; }

        public override IList<ScriptDescriptor> GetScriptDescriptors()
        {
            IList<ScriptDescriptor> list = base.GetScriptDescriptors();
            if (list.Count == 0)
                list.Add(new ExtJsScriptControlDescriptor("Ext.util.Observable", this.ClientID));

            ScriptControlDescriptorBase desc = (ScriptControlDescriptorBase)list[0];

            if (!String.IsNullOrEmpty(listeners))
                desc.AddPropertyBase("listeners", listeners);

            RegisterClientEvents(desc);

            return list;
        }
    }
}
